let getQueryString = function(name) {
	var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
	var r = window.location.search.substr(1).match(reg);
	if(r != null) {
		return unescape(r[2]);
	}
	return null;
};
const vm = new Vue({
	el: "body>article",
	data: {
		vo: {},
	},
	methods: {
		deleteOne: function() {
			axios.delete(`/elder/${getQueryString('id')}`).then(function(resp) {
				if(resp.code === "ok") {
					toast("删除成功");
				} else {
					toast(resp.message);
				}
			});
		},
		update: function() {
			console.log(getQueryString('id'));
			axios.put(`/elder/${getQueryString('id')}`,this.vo).then(function(resp) {
				if(resp.code === "ok") {
					toast("ok");
				} else {
					toast(resp.message);
				}
			})
		}
	},
	created:function(){
		axios.get(`/elder/${getQueryString('id')}`).then(function(resp) {
				if(resp.code === "ok") {
					vm.vo=resp.data;
				} else {
					toast(resp.message);
				}
			})
		
	}
	
})